package com.mydemo.design_pattern.structure_type.proxy_pattern.cglib;

import org.springframework.cglib.proxy.Enhancer;

/**
 * <p></p >
 *
 * @author liming1
 * @version $Id: DemoTest, v1.0 2019-09-19 11:36 liming1 Exp $
 */
public class DemoTest {
    public static void main(String[] args) {
        Enhancer enhancer = new Enhancer();
        // 设置需要代理的对象
        enhancer.setSuperclass(Engineer.class);
        // 设置代理人
        enhancer.setCallback(new CglibProxy(new Engineer()));
        Engineer o = (Engineer)enhancer.create();
        o.eat();
    }
}
